package com.xyx.ssm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xyx.ssm.dao.WinetypeMapper;
import com.xyx.ssm.jdbcdao.WinetypeDao;
import com.xyx.ssm.po.Winetype;
import com.xyx.ssm.service.WinetypeService;
import com.xyx.ssm.util.Page;
@Service("WinetypeService")
public class WinetypeServiceImpl implements WinetypeService{

	@Autowired
	private WinetypeMapper winetypeMapper;
	@Autowired
	private WinetypeDao winetypeDao;
	
	@Override
	public Page<Map<String, Object>> findPage(Page<Map<String, Object>> page) {
		// TODO Auto-generated method stub
		return winetypeDao.findPage("com.xyx.ssm.jdbcdao.WintypeDao.SelectAllpage", page);
	}
	//根据ID查询
	@Override
	public List<Winetype> selectWinetype(Integer id) {
		// TODO Auto-generated method stub
		List<Winetype> list=winetypeDao.selectWinetype(id);
		return list;
	}
	
	//新增
	@Override
	public int insertwinetype(Winetype record) {
		// TODO Auto-generated method stub
		int n=winetypeMapper.insertwinetype(record);
		return n;
				
	}
	
	//修改
	@Override
	public int updatewinetype(Winetype record) {
		// TODO Auto-generated method stub
		return winetypeMapper.updatewinetype(record);
	}
	
	//删除
	@Override
	public int deletewinetype(String ids) {
		int n=0;
		String [] b=ids.split(",");
		for(String id: b){
			int i=Integer.parseInt(id);
			n=winetypeMapper.deletewinetype(i);
		}
		return n;
	}

}
